/**
 * Copyright 2016 JustWayward Team
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hzf.booklibrary.api;

import com.hzf.booklibrary.bean.AutoComplete;
import com.hzf.booklibrary.bean.BookClassify;
import com.hzf.booklibrary.bean.BookRead;
import com.hzf.booklibrary.bean.BookSource;
import com.hzf.booklibrary.bean.BookToc;
import com.hzf.booklibrary.bean.ChapterRead;
import com.hzf.booklibrary.bean.HotWord;
import com.hzf.booklibrary.bean.Recommend;
import com.hzf.booklibrary.bean.RecommendBookList;


import java.util.List;

import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import rx.Observable;

/**
 * https://github.com/JustWayward/BookReader
 *Retrofit内置对RxJava的支持，所以可以直接返回Observable对象
 * @author yuyh.
 * @date 2016/8/3.
 */
public interface BookApiService {
    //class
    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=booksrecommendListByClassId")
    Observable<Recommend> booksrecommendListByClassId(@Query("classId") Integer classId);

    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=booksrecommendListByPage")
    public Observable<Recommend> booksrecommendListByPage(@Query("page") Integer page, @Query("pageSize") Integer pageSize,@Query("classId") Integer classId);

    //school
    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=sBooksrecommendListByPage")
    Observable<Recommend> getRecomend(@Query("page") String page,@Query("pageSize") String pageSize);

    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=sBooksQueryBraryByPageCN")
    Observable<Recommend> searchBooks(@Query("page") String page,@Query("pageSize") String pageSize,@Query("queryStr") String query);

    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=sBooksByclassifyid")
    Observable<Recommend> getBooksByClassifid(@Query("page") String page,@Query("pageSize") String pageSize,@Query("classifyid") String classifyid);


    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=sBooksClassifyMap")
    Observable<BookClassify> getBookClassify();//获取分类列表


////
//    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=booksrecommendListByPage")
//    Observable<Recommend> getRecomend(@Query("page") String page,@Query("pageSize") String pageSize);
//    /**
//     * 书籍查询
//     *
//     * @param query
//     * @return
//     */
//    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=booksQueryBraryByPageCN")
//    Observable<Recommend> searchBooks(@Query("page") String page,@Query("pageSize") String pageSize,@Query("queryStr") String query);
//
//    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=booksByclassifyid")
//    Observable<Recommend> getBooksByClassifid(@Query("page") String page,@Query("pageSize") String pageSize,@Query("classifyid") String classifyid);
//
//
//    @GET("Book/cloud/httpCommandService?cmd=books&cmd_op=booksClassifyMap")
//    Observable<BookClassify> getBookClassify();//获取分类列表
//



    @GET("/book/hot-word")
    Observable<HotWord> getHotWord();

    @GET("/atoc")
    Observable<List<BookSource>> getBookSource(@Query("view") String view, @Query("book") String book);

    @GET("/mix-toc/{bookId}")
    Observable<BookRead> getBookRead(@Path("bookId") String bookId);

    @GET("/mix-atoc/{bookId}")
    Observable<BookToc> getBookToc(@Path("bookId") String bookId, @Query("view") String view);

    @GET("/btoc/{bookId}")
    Observable<BookToc> getBookBToc(@Path("bookId") String bookId, @Query("view") String view);

    @GET("http://chapter2.zhuishushenqi.com/chapter/{url}")
    Observable<ChapterRead> getChapterRead(@Path("url") String url);
    /**
     * 关键字自动补全
     *
     * @param query
     * @return
     */
    @GET("/book/auto-complete")
    Observable<AutoComplete> autoComplete(@Query("query") String query);

    @GET("/book-list/{bookId}/recommend")
    Observable<RecommendBookList> getRecommendBookList(@Path("bookId") String bookId, @Query("limit") String limit);



}